<template>
    <h2>登录页面</h2>

    <div>
        <!--用户名-->
        <input type="text" v-model="username"><br />
        <!--密码框类型-->
        <input type="text" v-model="userpass"><br />
        <!--登录按钮-->
        <button @click="logins">登录</button>
    </div>
</template>

<script lang="ts">
export default {
    data() {
        return {
            //页面加载为空
            username: '',
            userpass: ''
        }
    },
    methods: {
        logins() {
            //非空验证
            if (this.username == "" || this.userpass == "") {
                //弹出框提示
                alert("登录名和密码不能为空");
                return;
            }
            //验证用户名和密码
            if (this.username !== "Admin123" || this.userpass !== "Admin123") {
                //弹出框
                alert("登录名和密码错误");
                return;
            }
            //输出参数
            console.log(this.username, this.userpass)
        },


    }
}
</script>